How to make a write-host recognizable on TFS?
How to make a write-host recognizable on TFS?
17602-Aug-2023
Updated on 03-Aug-2023
Home / DeveloperSection / Forums / How to make a write-host recognizable on TFS?
How to make a write-host recognizable on TFS?
Aryan Kumar
03-Aug-2023The
Write-Host
command is not recognized by TFS by default. This is because TFS uses a different version of PowerShell than the one that is installed on your local machine. To makeWrite-Host
recognizable on TFS, you can redefine the command in your PowerShell profile.Here is an example of how to do this:
Once you have saved this code in your PowerShell profile, you will be able to use
Write-Host
in your TFS scripts. The output of the command will be displayed in the TFS console window.Here is an example of how to use
Write-Host
in a TFS script:This will display the message "This is a message from Write-Host" in the TFS console window.
Here are some additional things to keep in mind when using
Write-Host
on TFS:Write-Host
will not be colored in the TFS console window.Write-Host
will be a wrapper forWrite-Information
. This means that the output ofWrite-Host
will be displayed in the information stream, which is not the default stream for TFS.